# -*- coding:utf-8 -*-
# @Time: 2020/8/24 14:59
# @Author: liupengfei
# @File: __init__.py.py
from rest_framework import status
from rest_framework.response import Response


def response_error(msg, errcode=None):
    code = status.HTTP_400_BAD_REQUEST
    if errcode:
        code = errcode
    return Response({"status": False, "message": msg}, status=code)


def response_ok(data=None):
    code = status.HTTP_200_OK
    if data:
        return Response({"status": True, "data": data}, status=code)
    return Response({"status": True}, status=code)
